<link href="../addons/jy_weishop/resource/css/room.css?v=6" rel="stylesheet">
<link href="../core/resource/components/swiper/swiper.min.css" rel="stylesheet" type="text/css">
<style>
    html, body {
      position: relative;
      height: 100%;
	  overflow:hidden;
    }
    body {
      background: #eee;
      font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
      font-size: 14px;
      color:#000;
      margin: 0;
      padding: 0;
    }
    .swiper-container {
      width: 100%;
      height: 100%;
    }
    .swiper-slide {
      text-align: center;
      font-size: 18px;
      background: #fff;

      /* Center slide text vertically */
      display: -webkit-box;
      display: -ms-flexbox;
      display: -webkit-flex;
      display: flex;
      -webkit-box-pack: center;
      -ms-flex-pack: center;
      -webkit-justify-content: center;
      justify-content: center;
      -webkit-box-align: center;
      -ms-flex-align: center;
      -webkit-align-items: center;
      align-items: center;
    }
.fe-floatright-bottom {
    min-height: 10px;
    position: fixed;
    bottom: 15px;
	right:15px;
    text-align: center;
    z-index: 1003;
}
.fe-floatright-bottom a{
    display: block;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 100%;
    background-color: #333;
	color:#fff;
	line-height:1.6rem;
	margin: 0 auto;
    margin-right: 0;
}
.fe-floatright-bottom a .icon{
	color:#fff;
	font-size:1.1rem;
	height:1.6rem;
	opacity:1;
}
.sw_progress {
    position: absolute;
    display: none;
    height: 3px;
    width: 100%;
    bottom: 0;
    left: 0;
    z-index: 100;
    background-color: rgba(0,0,0,.2);
}
.sw_progress span {
    display: block;
    height: 100%;
    width: 0;
    background-color: #08A1EF;
    transition: width 800ms cubic-bezier(0.260,.860,.440,.985);
}
.avatar-follow{
	height: 50px;
    width: 50px;
    background: #fff;
    margin: auto;
    border-radius: 50px;
    border: 2px solid #fff;
}

.footer-msg{
	 position: fixed;
	 bottom:0;
}
.likepiaofu img{width: 0px;position: fixed; bottom: 100px; right: 15px;}
.followpiaofu img{width: 0px;position: fixed; bottom: 260px; right: 25px;}
.fui-icon-group .fui-icon-col {
    margin: 0;
}
.search-input input {border: 0px solid #b4b4b4;background:#000;border-radius:1.2rem;padding:0.4rem 0.5rem;opacity:0.3;color:#fff;}
.fui-header:after {border-bottom: 0px solid #D9D9D9;}
.fui-tag-red-o{margin:0.2rem;color: #fff;font-size:0.50rem;line-height:0.5rem;-webkit-border-radius: 0.4rem;border-radius: 0.4rem;font-style: normal;padding:0.2rem 0.5rem;border: 1px solid #fff;}
/*拆红包*/
.chaihb{
    text-align: center;
	position:fixed;
	z-index:4;
	left: 50%;
	top: 40px;
	margin-left: -125px;
}
.mengc{
  position: fixed;
  z-index: 1;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.6);
  overflow:auto;
}
.hongbao{
    background: #A5423A;
    width: 250px;
    height: 400px;	
	position: relative;	
    left: 0;
    top: 0;
	z-index:5;
    border-radius: 10px;
    margin: 0 auto;	
}
.topcontent{
    height: 280px;
    border: 1px solid #BD503A;
    background-color: #BD503A;
    border-radius: 10px 10px 50% 50% / 10px 10px 15% 15%;
    box-shadow: 0px 4px 0px -1px rgba(0,0,0,0.2);
}
.avatar{
    position: relative;
}
.avatar span{
    position: absolute;
    top: 10px;
    right: 15px;
    -webkit-transform: rotate(45deg);
        -ms-transform: rotate(45deg);		
            transform: rotate(45deg);
    font-size: 2em;
    font-weight: bolder;
}
#close{
    color: rgba(0,0,0,0.5);
}
.avatar img{
    border: 1px solid #BD503A;
    border-radius: 50%;
    overflow: hidden;
    margin-top: 10%;
}
.topcontent h2{
    margin: 3px 0;
}
.text{
    color: #999;
}
.description{
    margin: 15px 0;
    font-size: 16px;
    font-weight: 600;
}
#chai{
    width: 100px;
    height: 100px;
    border: 1px solid #FFA73A;
    background-color: #FFA73A;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    display: inline-block;
    margin-top: -50px;
    box-shadow: 0px 4px 0px 0px rgba(0, 0, 0, 0.2);
}
#chai span{
    margin-top: 35px;
    display: inline-block;
}
.rotate{
    -webkit-animation: anim .9s;
	-ms-animation: anim .9s  ;
            animation: anim .9s  ;
}
@-webkit-keyframes anim {
    from { -webkit-transform: rotateY(0deg); }
    to { -webkit-transform: rotateY(360deg); }
}
@-ms-keyframes anim {
    from { -ms-transform: rotateY(0deg); }
    to { -ms-transform: rotateY(360deg); }
}
@-o-keyframes anim {
    from { -o-transform: rotateY(0deg); }
    to { -o-transform: rotateY(360deg); }
}
@keyframes anim {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}
/*红包页面*/
.money{
	width:90%;
	max-width:320px;
	height:300px;
	background:#fff;
	margin:0 auto;
	color:black;
	font-size:14px;
}
.money p{
	color:black;
	font-size:14px;
}
.moneytop{
	width:100%;
	height:120px;
	background:#da4d43;
	border-radius: 0 0 50% 50% / 0 0 45% 45%;
}
.moneyimg{
	width: 60px;
	height: 60px;
	margin: 0 auto;
	margin-top: -50px;
	border-radius: 50%;	
}
.moneyimg img{
	width:60px;
	height: 60px;	
    border-radius: 50%;
    overflow: hidden;	
}
.moneyfont{
	margin-top: 20px;
}
.moneynum p{
	font-size:28px;
}
.moneysize{
	color:red;
}
.moneybtn{
	position: relative;
	margin-top: 20px;
	border: 0;
	padding: 10px;
	border-radius: 5px;
	font-size: 18px;
	box-shadow: 3px 4px #fff;
	background: #fe4b44;
	color: #fff;
	animation: moneybtn 200ms infinite alternate;
	-webkit-animation: moneybtn 200ms infinite alternate;	
}
@keyframes moneybtn{
	0%{
		box-shadow: 3px 4px #fff;
		top: 0px;		
	}
	50%{
		box-shadow: 2px 2px #fff;
		top: 1px;
	}	
	100%{
		box-shadow: 1px 0px #fff;
		top: 2px;
	}	
}
@-webkit-keyframes moneybtn{
	0%{
		box-shadow: 3px 4px #fff;
		top: 0px;		
	}
	50%{
		box-shadow: 2px 2px #fff;
		top: 1px;
	}	
	100%{
		box-shadow: 1px 0px #fff;
		top: 2px;
	}	
}
.u-guidevideo {
	width:38px;
	height:38px;
	background-size:100%;
	position:absolute;
	left:50%;
	bottom:50%;
	margin-top:-19px;
	margin-left:-19px;
	display:block;
	z-index:9998
}
source{
    min-width: 100%;
    min-height: 100%;
    height: auto;
    width: auto;
}
.fe-floatico-bottom {
    min-height: 10px;
    width: 60px;
    position: fixed;
    margin: 5px;
    z-index: 1000;
}
.vjs-error-display {display:none;}
.vjs-poster {display:none;}
.vjs-control-bar {display:none;}
.vjs-text-track-settings {display:none;}
.vjs-loading-spinner {display:none;}
.vjs-hidden {display:none;}
.video-js .vjs-big-play-button {display:none;}
video {background:none}
    .hidden{
        display: none;
    }
    .wave {
        position: relative;
        width: 100px;
        height: 100px;
        text-align: center;
        line-height: 110px;
        font-size: 40px;
    }

    .wave .circle {
        position: absolute;
        border-radius: 50%;
        opacity: 0;
    }

    /* 波纹效果 */
    .wave.ripple .circle {
        width: calc(100% - 6px); /* 减去边框的大小 */
        height: calc(100% - 6px); /* 减去边框的大小 */
        border: 3px solid #fff;
    }

    .wave.ripple .circle:first-child {
        animation: circle-opacity 2s infinite;
    }

    .wave.ripple .circle:nth-child(2) {
        animation: circle-opacity 2s infinite;
        animation-delay: .3s;
    }

    .wave.ripple .circle:nth-child(3) {
        animation: circle-opacity 2s infinite;
        animation-delay: .6s;
    }
    .wave.ripple.warning {
        color: #f1f1f1;
    }

    .wave.ripple.warning .circle {
        border-color: #f1f1f1;
    }
    .wave.solid .circle{
        width: 100%;
        height: 100%;
        background: #fff;
    }
    .wave.solid .circle:first-child {
        animation: circle-opacity 2s infinite;
    }
    .wave.solid.warning {
        color: #f1f1f1;
    }

    .wave.solid.warning .circle{
        background: #f1f1f1;
    }

    @keyframes circle-opacity{
        from {
            opacity: 1;
            transform: scale(0);
        }
        to {
            opacity: 0;
            transform: scale(1);
        }
    }
    .video-js.vjs-playing .vjs-tech {
        pointer-events: auto;
    }

</style>
<header class="app-header">
	<div ng-if="pagedata.item.video" class="block-title">{{pagedata.item.title}}</div>
	<!-- 关注按钮 -->
	<!--弹目-->
	<div ng-if="pagedata.showtanmus && !pagedata.setting.no_tanmu" class="video-sms-pane {{pagedata.transition?'transition':''}}">
			<div class="video-sms-text">
				<image class="video-sms-logo" src="{{pagedata.tanmus[pagedata.nowmsgid].avatar}}"/>
				<span class="overflow-h"> 最新订单来自 {{pagedata.tanmus[pagedata.nowmsgid].nickname}}</span>
			</div>
	</div>
	<div id="goback" class="fe-floatback right" style="left: 4px;">
		<a href="javascript:void(0);" ng-click="access_json('index/')">
		<i class="icon icon-back"></i>
		</a>
	</div>
	<div class="likepiaofu"></div>
	<div class="followpiaofu"></div>
	<!--<a href="javascript:void(0);" id="audio_btn" class="off video_exist rotate">
		<div id="yinfu"></div>
		<audio src="" autoplay="autoplay" loop="loop"></audio>
	</a>
	<div class="music-loading">
	</div>-->
	<div ng-if="pagedata.goods.title" href="javascript:" onclick="$('#showspec').modal();" class="left-living fui-list-group merchgroup" style="position: fixed;width:10rem;bottom:4rem;height:auto;padding:0.2rem">
            <div class="fui-list jump " style="padding:0.2rem">
                <a class="fui-list-media">
                    <img class="round" ng-src="{{tomedia(pagedata.goods.image) ||'../core/resource/images/nopic.jpg'}}">
                </a>
                <a class="fui-list-inner" style="color:#fff">
                    <div class="title" style="color:#fff">{{pagedata.goods.title}}</div>
                    <div class="price">￥<span class="red">{{pagedata.goods.price}}</span></div>
                </a>
                <a class="fui-remark jump">
                </a>
            </div>   
	</div>
	<div class="video-keep-pane" style="right:-0.7rem;bottom:190px">
		<div class="video-keep-text">
			<img ng-repeat="img in pagedata.lookusers" class="video-keep-logo" style="margin-left:-1rem" ng-src="{{tomedia(img.avatar) || '../core/resource/images/nopic.jpg'}}"/>
			<span class="overflow-h">{{pagedata.item.looks || 0}}人</span>
		</div>
	</div>
	<div class="fe-floatright-bottom right" href="javascript:;" ng-click="pagedata.setfollow();toogle(pagedata.item,'islike',[1,0]);" style="bottom:275px;right:8px">
		<div class="avatar-follow"><img class="img-circle" ng-src="{{tomedia(pagedata.pluginset.logo) || '../core/resource/images/gw-user.png'}}" style="width:46px;height:46px" /></div>
			<i ng-class="{'icon jinyunicon':1,'icon-follow':pagedata.item.islike !=1,'icon-xiai':pagedata.item.islike ==1}" style="color:red;position: absolute;top:33px;right:16px"></i>
	</div>
	<div class="fe-floatright-bottom right" style="bottom:125px">
		<a ng-click="pagedata.setshoucang();">
			<i ng-class="{'icon jinyunicon':1, 'icon-good':pagedata.item.islike!=1,'icon-good-filling':pagedata.item.islike==1}"></i>
		</a>
		<span style="font-size:0.5rem;color:#fff">{{pagedata.item.islike==1?'已赞':'赞'}}:{{pagedata.item.likes || 0}}</span>
	</div>

	<div class="fe-floatright-bottom right" style="bottom:65px">
		<a onclick="$('#showsharecover').modal();">
			<i class="icon jinyunicon icon-fenxiang2"></i>
		</a>
		<span style="font-size:0.5rem;color:#fff">转发</span>
	</div>
	<div class="footer-msg" style="width:calc(100% - 50px);z-index:1003">
        <div class="fui-cell-group" style="background:none;margin-top:0">
			<div class="fui-cell noborder">
				<div class="fui-cell-text" style="color:#fff;font-size:0.5rem"><img src="../addons/jy_weishop/resource/images/auido-bai.gif" style="margin-top:-2px;width:10px;height:10px" /> {{pagedata.item.desc || '我为《'+pagedata.item.title+'》代言~~'}}</div>
			</div>
			<div ng-if="pagedata.ismsg ==1" class="fui-cell noborder" style="padding-top:0">
				<div class="fui-cell-info" ng-click="pagedata.getmsg();pagedata.msgshow = 1" style="background:#666;border-radius:1.2rem;padding:0.4rem 0.5rem;opacity:0.5;color:#fff;"><i class="icon jinyunicon icon-shuru" style="color:#fff"></i>写支持语/评论...</div>
			</div>
			<div ng-if="pagedata.ismsg !=1" class="fui-cell noborder" style="padding-top:0">
				<div class="fui-cell-info"  onclick="$('#showzufu').modal();" style="background:#666;border-radius:1.2rem;padding:0.4rem 0.5rem;opacity:0.5;color:#fff;"><i class="icon jinyunicon icon-shuru" style="color:#fff"></i>写支持语/评论...</div>
			</div>
		</div>
    </div>
</header>
<div id="followbar" class="modal fade" tabindex="-1" style="display:none;">
		<div class="modal-dialog" style="width:60%;left:20%">
			<div class="modal-content">
				<div class="wap-qrcode-container">
					<p class="example1">{{pagedata.pluginset.title || '欢迎浏览'}}</p>
						<div class="wap-qrcode-image">
							<img ng-src="{{tomedia(pagedata.pluginset.ewm) || '../core/resource/images/nopic.jpg'}}"/>
						</div>
					<p class="example1">长按二维码关注</p>
				</div>
			</div>
		</div>
</div>
<div id="showzufu"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
<div class="modal-dialog" style="width:100%;left:0%;bottom:0">
<div class="modal-content" >
    <!--评价-->
		<div class="fui-header searchtop" style="margin:0 0.3rem;background:#fff;position:relative">
			<div class="title">
				<div class="searchbar searchbar-active" style="margin:0.4rem 2.6rem 0.4rem 0">
						<div class="search-input">
							<input type="text" style="border-radius:1.2rem;" ng-model="pagedata.post.msg" placeholder="写评论..." value="{{pagedata.post.msg}}">
						</div>
				</div>
			</div>
			<div class="fui-header-right">
				<a aria-hidden="true" data-dismiss="modal" ng-click="pagedata.setmsg(pagedata.post.msg,pagedata.item.id);pagedata.islike=1">发布</a>
			</div>
		</div>
		<div class="fui-icon-group noborder col-4" style="background: #ffffff;padding-left:15px;padding-right:15px;padding-bottom:15px">
			<a class="fui-icon-col external" href="javascript:;" ng-click="pagedata.post.msg = '不错！加油，看好你哦!'">
					<div class="icon"><i class="icon jinyunicon icon-biaoqing"></i></div>
					<div class="text" style="color: #666666;">加油！加油！</div>
			</a>
			<a class="fui-icon-col external" href="javascript:;" ng-click="pagedata.post.msg = '宝贝!你最棒！'">
					<div class="icon"><i class="icon jinyunicon icon-wentifankui"></i></div>
					<div class="text" style="color: #666666;">没视频,差评！</div>
			</a>
			<a class="fui-icon-col external" href="javascript:;" ng-click="pagedata.post.msg = '点赞！点赞!'">
					<div class="icon"><i class="icon jinyunicon icon-biaoqing"></i></div>
					<div class="text" style="color: #666666;">点赞！点赞</div>
			</a>
			<a class="fui-icon-col external" href="javascript:;" ng-click="pagedata.post.msg = '好样的！有出息！'">
					<div class="icon"><i class="icon jinyunicon icon-biaoqing"></i></div>
					<div class="text" style="color: #666666;">好样的！</div>
			</a>
			<a class="fui-icon-col external" href="javascript:;" ng-click="pagedata.post.msg = '不扶墙的！舅扶你！'">
					<div class="icon"><i class="icon jinyunicon icon-biaoqing"></i></div>
					<div class="text" style="color: #666666;">不扶墙！舅扶你！</div>
			</a>
			<a class="fui-icon-col external" href="javascript:;" ng-click="pagedata.post.msg = '棒棒的！这东西不错！'">
					<div class="icon"><i class="icon jinyunicon icon-biaoqing"></i></div>
					<div class="text" style="color: #666666;">棒棒的！这东西不错！</div>
			</a>
			<a class="fui-icon-col external" href="javascript:;" ng-click="pagedata.post.msg = '好想入手，实力不允许！'">
					<div class="icon"><i class="icon jinyunicon icon-wentifankui"></i></div>
					<div class="text" style="color: #666666;">好想入手,实力不允许！</div>
			</a>
			<a class="fui-icon-col external" href="javascript:;" ng-click="pagedata.post.msg = '这什么东西，没看懂！'">
					<div class="icon"><i class="icon jinyunicon icon-bangzhu1"></i></div>
					<div class="text" style="color: #666666;">这什么东西,没看懂！</div>
			</a>
		</div>
</div>
</div>
</div>

<div ng-if="pagedata.msgshow == 1"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
<div class="modal-dialog" style="width:100%;left:0%;bottom:0">
<div class="modal-content" >
    <!--评价-->
		<div class="fui-cell-group fui-comment-group">	
				<div class="fui-cell">
					<div class="fui-cell-icon" aria-hidden="true" data-dismiss="modal"><i class="icon jinyunicon icon-close"></i></div>
					<div class="fui-cell-h3" style="margin-left:-22px">{{pageadta.msgnum || 0}}条评论</div>
				</div>
				<div ng-repeat="m in pagedata.msg" class="fui-cell fui-cell-click noborder">
					<div class="fui-cell-icon" style="width:46px;margin-top:-10px"><img class="img-circle" ng-src="{{tomedia(m.avatar) || '../core/resource/images/gw-user.png'}}" style="width:46px;height:46px" /></div>
					<div class="fui-cell-text desc">
						<div class="fui-cell noborder" style="padding:0.25rem">
							<div class="fui-cell-text" style="color:#f60">{{m.username || '匿名用户'}}</div>
							<div class="fui-cell-text r"><i class="icon jinyunicon icon-good"></i>{{m.likenum || '赞'}}</div>
						</div>
						<div class="fui-cell noborder padding03" style="padding:0.25rem">
							<div class="fui-cell-text" style="color:#000">
								{{m.msg || '没有任何评价留言信息！'}}
							</div>
						</div>
						<div class="fui-cell noborder padding03" style="padding:0.25rem">
							<div class="fui-cell-text" style="font-size:0.5rem">
								{{m.timetitle}} 
							</div>
						</div>
					</div>
				</div>
	</div>
</div>
</div>
</div>
<div class="fui-page">
<div class="swiper-container fullscreen">
	<div id="my-videoblock" class="swiper-wrapper block-video">	
		<video preload="auto" poster="{{tomedia(pagedata.item.image)}}" id="player" playsinline webkit-playsinline x5-video-player-type="h5-page" style="margin: auto;" autoplay="autoplay" class="video-js" width="100%" height="100%">
                <source ng-src="{{tomedia(pagedata.item.video)}}"  type="video/mp4">
        </video>
	</div>
	<div id="control" class="prompt">
		<div class="live-tips loading">
                <div class="inner">
                    <div class="text">加载视频中</div>
                    <div class="date"></div>
                </div>
         </div>
		<div id="pauseBtn" class="live-tips play btn-play" style="margin-top:-6.6rem">
                <div class="inner" style="background:none;width: 100px;">
					<div class="wave solid warning">
						<div class="circle"></div>
						<div class="content">
							 <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5228" width="32" height="32"><path d="M732.502883 465.602819c-107.883492-82.3454-215.772403-164.681769-323.652282-247.014525-38.414608-29.327534-93.780555-1.929039-93.780555 46.396277v494.029051c0 48.325316 55.365948 75.725617 93.780555 46.398084 107.87988-82.332757 215.76879-164.669126 323.652282-247.014525 30.61356-23.357989 30.61356-69.436372 0-92.794362z" fill="#ffffff" p-id="5229"></path></svg>
						</div>
					</div>
                </div>
        </div>
	 </div>
</div>
</div>
<!--分享弹层-->
<div id="showsharecover" class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
<div class="modal-dialog" style="width:100%;left:0;top:0">
	<div id="cover">
		<div class='fui-mask-m visible'></div>
		<div class='arrow'></div>
		<div class='content'>请点击右上角<br/>通过【发送给朋友】<br/>邀请好友点赞哦！</div>
	</div>
</div>
</div>
<div id="showspec" class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
	<div class="modal-dialog" style="width:100%;left:0;bottom:0">
	<div class="modal-content" ng-include="sys_html('video/picker')"></div>
	</div>
</div>
<script src="../addons/jy_weishop/resource/js/live.js"></script>
<script>
//概率计算
scope.pagedata.random=function(rate){
	var rate = parseInt(rate);
	var n = Math.random() * 100;
	if(n <= rate){
		return true
	}else{
		return false
	}
}
scope.pagedata.getitem=function(type){
	if(type==1){
		var goodsid=scope.pagedata.onid
	}else{
		var goodsid=scope.pagedata.nextid
	}
	scope.page_loading();
	scope.get('jy_weishop/video.detail//id='+goodsid,function(res){
		scope.pagedata=$.extend(scope.pagedata,res)
		scope.page_loading('hide');
		if(scope.pagedata.item.video){
			live(1);
		}
		scope.$evalAsync();
	});
}
require(['swiper'], function (Swiper) {
	console.log('swiper')
    var swiper = new Swiper('.swiper-container', {
      direction: 'vertical',
      pagination: {
        el: '.swiper-pagination',
        //clickable: true,
      },
	  on:{
        touchEnd:function(event){
			console.log(swiper.translate)
			var _contentHeight = document.getElementsByClassName('swiper-container')[0].offsetHeight;
			var allheight = _contentHeight*(scope.pagedata.item.images.length-1)
			scope.pagedata.contentHeight=_contentHeight;
			scope.$evalAsync();
			console.log('_contentHeight');console.log(_contentHeight)
			console.log(allheight)
			if((swiper.translate<= -allheight- 50 && swiper.translate < 0) && (scope.pagedata.next || scope.pagedata.item.images.length==1 || scope.pagedata.item.video)){
				 if(!scope.pagedata.nextmsg && !scope.pagedata.item.video){
					scope.pagedata.nextmsg=true
					scope.pagedata.getitem();
					//scope.message('最后一张图了,再次上滑阅读下一商品！');
				 }else{
					if(scope.pagedata.nextid){
						//window.location.href=scope.pagedata.nexturl
						scope.pagedata.getitem();
					}else{
						scope.message('已经是最后一个商品了！');
					}
					//scope.access_json('jy_weishop/o_detail//id='+scope.pagedata.nextid)
				 }
			}
			if((swiper.translate>= 60)){
				 if(!scope.pagedata.onmsg && !scope.pagedata.item.video){
					scope.pagedata.onmsg=true
					scope.pagedata.getitem(1);
					//scope.message('已经是第一张图了,再次下滑阅读上一商品！');
				 }else{
					if(scope.pagedata.onid){
						//window.location.href=scope.pagedata.onurl
						scope.pagedata.getitem(1);
					}else{
						scope.message('已经是第一个商品了！');
					}
					//scope.access_json('jy_weishop/o_detail//id='+scope.pagedata.onid)
				 }
			}
        },        
        slidePrevTransitionEnd:function(){
			console.log('prev')
            scope.pagedata.next=false
			scope.pagedata.nextmsg=false
        },
        slideNextTransitionEnd:function(){
			scope.pagedata.index = swiper.activeIndex;
			scope.pagedata.next=true;
			scope.pagedata.onmsg=false
			console.log('next');
        },
	}
    });
});
//收藏
scope.pagedata.setshoucang=function(){
	var params={
		data:{'isshoucang':scope.pagedata.isshoucang},
		op:'like',
		callback:function(res){
			if(scope.pagedata.item.islike==1){
				scope.pagedata.item.islike=0
				scope.pagedata.item.likes--
			}else{
				scope.pagedata.item.islike=1
				scope.pagedata.item.likes++
			}
			scope.$evalAsync();
			scope.message(res)
		}
	};
	scope.post_json(params);
}
//获取关注
scope.pagedata.setfollow=function(){
	var params={
		op:'like',
		callback:function(res){
			scope.message(res)
			var time = 0
			for(var i = 0;i<88;i++){
				setTimeout('followpiaofu()',time);
				if(i<10){
					time += 100
				}else if(i>=10 && i<20){
					time += 200
				}else if(i>=20 && i<30){
					time += 300
				}else if(i>=30 && i<40){
					time += 400
				}else if(i>=40 && i<50){
					time += 500
				}else if(i>=50 && i<60){
					time += 600
				}else if(i>=60 && i<70){
					time += 700
				}else if(i>=70 && i<80){
					time += 800
				}else{
					time += 900
				}
			}
		}
	};
	scope.post_json(params);
}
//获取留言
scope.pagedata.getmsg=function(){
	var params={
		data:{},
		op:'getmsg',
		callback:function(res){
			scope.$evalAsync();
		}
	};
	scope.post_json(params);
}
//提交留言
scope.pagedata.setmsg=function(msg,id){
	if(!msg){
		scope.message('发布失败，没有内容！','error');
	}
	var params={
		data:{'msg':msg,'id':id},
		op:'setmsg',
		callback:function(res){
			scope.message(res.msg)
			vote_tanmu(msg,res.avatar)
		}
	};
	scope.post_json(params);
}
function likepiaofu() {
		var x = 100;       
		var y = 330;
		var num = Math.floor(Math.random() * 6 + 1);
		var index=$('.likepiaofu').children('img').length;
		var rand = parseInt(Math.random() * (x - y + 1) + y); 
		$(".likepiaofu").append("<img src=''>");
		$(".likepiaofu").find('img:eq(' + index + ')').attr('src','../addons/jy_weishop/resource/img/like_icon_'+num+'.png')
		$(".likepiaofu").find("img").animate({
			bottom:"500px",
			opacity:"0",
			right: rand,
			width:"32px"
		},3000)
}
function followpiaofu() {
		var x = 100;       
		var y = 330;
		var num = Math.floor(Math.random() * 6 + 1);
		var index=$('.followpiaofu').children('img').length;
		var rand = parseInt(Math.random() * (x - y + 1) + y); 
		$(".followpiaofu").append("<img src=''>");
		$(".followpiaofu").find('img:eq(' + index + ')').attr('src','../addons/jy_weishop/resource/img/follow_icon_'+num+'.png')
		$(".followpiaofu").find("img").animate({
			bottom:"500px",
			opacity:"0",
			right: rand,
			width:"32px"
		},3000)
}
function reset_body(){
	document.body.scrollTop = document.body.scrollTop;
}
//信息弹窗：
//前端先注册以等待接收消息
require(['jinyun_socket'],function(jinyun_socket){
    jinyun_socket.connect();
    jinyun_socket.onsystem=function(res){
        if(res.message){
			var success_title = '确认';
			if(res.url){
				success_title = '前往查看';
			}
			scope.confirm({
						'message':res.message,
						'success':res.url,
						'success_title':success_title
			});
		}
    }
});
if(scope.pagedata.msgs.length>0){
	var msgs=scope.pagedata.msgs;
	var k=0
	for(var i = 0;i<msgs.length;i++){
		setTimeout(
			function(){
					vote_tanmu(msgs[k].content,msgs[k].avatar);
					k++;
			}
		,1700*i);
	}
}
//减少
scope.pagedata.minus=function(){
	if(scope.pagedata.post.num <=1){
		return false;
	}
	scope.pagedata.post.num--;
	scope.$evalAsync();
}
//增加
scope.pagedata.plus=function(){
	if(scope.pagedata.item.usermaxbuy>0 && scope.pagedata.item.order_goodscount + scope.pagedata.post.num>=scope.pagedata.item.usermaxbuy){
		scope.message('不能再加了，超过该商品最大购买量！','error');
		return false;
	}
	if(scope.pagedata.item.maxbuy>0 && scope.pagedata.post.num>=scope.pagedata.item.maxbuy){
		scope.message('不能再加了，超过该商品单次购买量！','error');
		return false;
	}
	if(scope.pagedata.post.num>=scope.pagedata.options.stock || scope.pagedata.post.num>=scope.pagedata.item.total){
		scope.message('不能再加了，超了库存啦！','error');
		return false;
	}
	scope.pagedata.post.num++;
	scope.$evalAsync();
}
//选择
scope.pagedata.get_optionsid=function(){
	var specid = scope.pagedata.post.specid;
		specid = specid.join('_');
	scope.post_json('jy_weishop/goods.detail/get_optionsid/',{'specid':specid},function(res){
			scope.pagedata.post.optionsid=res.options.id;
			scope.pagedata.options=res.options;
			scope.pagedata.item.price=res.options.price;
			scope.pagedata.item.originalprice=res.options.productprice;
			scope.pagedata.selespename=res.selespename;
			scope.$evalAsync();
	});
}
scope.pagedata.check_buy=function(){
	var goodsid=scope.pagedata.post.goodsid
	var num=scope.pagedata.post.num
	var optionsid=scope.pagedata.post.optionsid
	var addressid=scope.pagedata.post.addressid
	var storeid=scope.pagedata.post.storeid
	scope.get('jy_weishop/goods.detail/check_buy/goodsid='+goodsid+'&num='+num+'&optionsid='+optionsid+'&addressid='+addressid+'&storeid='+storeid,function(res){});
}
/*弹目*/
scope.pagedata.issocketmsg=false;
scope.pagedata.tanmuspage=0;
scope.pagedata.gettanmus=function() {
	if(!scope.pagedata.issocketmsg){
			scope.pagedata.nowmsgid=0;
			scope.get('jy_weishop/get_data/gettanmus/page='+scope.pagedata.tanmuspage,function(res){
						//console.log(res);
						scope.pagedata.tanmus=res.list
						if(scope.pagedata.tanmus.length>0){
							scope.pagedata.tanmuspage++;
							scope.pagedata.up_oldtanmu();
						}
			});
	}
}
//前端先注册以等待接收消息
require(['jinyun_socket'],function(jinyun_socket){	
    jinyun_socket.connect(function(res){
			console.log('加入ID为index的组：');console.log(res);
            jinyun_socket.join('videoroom');//加入ID为1的组
     });	 
    jinyun_socket.onsystem=function(res){
        console.log('收到来自后端的消息：');console.log(res);
		scope.pagedata.issocketmsg=true;
		if(scope.pagedata.setting.no_tanmu!=1){
			set_tanmu(res.nickname,res.avatar,res.time);
		}
    }
	//刚进入时；如果没有新订单消息，就弹储备订单消息
	if(scope.pagedata.setting.no_tanmu!=1){
		setTimeout(function(){
			scope.pagedata.gettanmus();
		},2000);
	}
});
scope.pagedata.up_oldtanmu=function() {
		if(scope.page.action=='video.detail'){
			var i=scope.pagedata.nowmsgid;
			if(i<scope.pagedata.tanmus.length){
				set_tanmu(scope.pagedata.tanmus[i].nickname,scope.pagedata.tanmus[i].avatar,scope.pagedata.tanmus[i].time);
			}else{
				scope.pagedata.gettanmus();
			}
		}else{
			return false;
		}
}
function set_tanmu(nickname,avatar,time) {
		scope.pagedata.nowmsgid++
		scope.pagedata.showtanmus=true
		//console.log('set_tanmu')
		scope.$evalAsync(scope.pagedata.showtanmus);
		setTimeout(function(){
			scope.pagedata.transition=true
			scope.$evalAsync(scope.pagedata.transition);	
		},300);
		setTimeout(function(){
			scope.pagedata.showtanmus=false
			scope.pagedata.transition=false
			scope.$evalAsync(scope.pagedata.showtanmus);	
		},2000);
		setTimeout(function(){
			//等待5秒，如果没有新的订单消息，就弹储备订单消息
			scope.pagedata.issocketmsg=scope.pagedata.issocketmsg?scope.pagedata.issocketmsg:false;
			if(!scope.pagedata.issocketmsg && scope.page.action=='index'){
				scope.pagedata.up_oldtanmu();
			}
		},4000);
}
</script>